package com.lm.stream.controller;

import com.lm.stream.service.impl.MessageProducer;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/msg")
public class MessageController {

    private final MessageProducer producer;

    public MessageController(MessageProducer producer) {
        this.producer = producer;
    }

    @GetMapping("/send")
    public String sendMessage(@RequestParam String text) {
        producer.send(text);
        return "消息已发送：" + text;
    }
}
